package ee.helmesWorkTest.frontend.controller;

import java.io.IOException;

import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import ee.helmesWorkTest.frontend.controller.MenuPageEnum;

public class ViewManager 
{
	private MenuPageEnum menuPageEnum;
	
	public void navigate(String view, HttpServletRequest request, HttpServletResponse response,ServletContext servletContext) 
			throws ServletException, IOException  
	{	
		try 
		{
			if (view.equals("insertPersonSectorInvolvementPage"))
			{
				menuPageEnum = MenuPageEnum.INSERT_PERSON_SECTOR_INVOLVEMENT_PAGE; 
			}
			
			switch (menuPageEnum) 
			{
				case INSERT_PERSON_SECTOR_INVOLVEMENT_PAGE:  
					servletContext.getRequestDispatcher("/insertPersonSectorInvolvementPage.jsp").forward(request, response);
					break ;
					
				default: 
					servletContext.getRequestDispatcher("/insertPersonSectorInvolvementPage.jsp").forward(request, response);
					break ;
			}
		}
		catch (Exception ex) 
		{
			ex.printStackTrace();
		}
	}
}